using UnityEngine;
using System.Collections;

public class StateVampRun : State<VampiroControl> 
{
    static StateVampRun m_instance = new StateVampRun();
    public static StateVampRun instance { get { return m_instance; } }

    public override void OnEnter(VampiroControl behaviour)
    {
		if (! behaviour.animation.IsPlaying("Atacar2")) {
			foreach (AnimationState state in behaviour.animation) {
        		state.speed = 1F;
    		}
			behaviour.animation.Play("Correr");
			behaviour.ComprobarDestino();
		}
		
//        behaviour.destino = behaviour.destinos[behaviour.contador];
    }

    public override void OnUpdate(VampiroControl behaviour)
    {
		
		if (! behaviour.animation.IsPlaying("Atacar2")) {
			foreach (AnimationState state in behaviour.animation) {
	        	state.speed = 1F;
	    	}
			behaviour.animation.Play("Correr");
		}
		if (behaviour.animation.IsPlaying("Correr")) {
			foreach (AnimationState state in behaviour.animation) {
	        	state.speed = 1F;
	    	}
	        behaviour.controller.destination = behaviour.destino;
	        behaviour.ComprobarDestino();
		}
    }

    public override void OnExit(VampiroControl behaviour)
    {
        behaviour.controller.ResetPath();
    }

    public override void OnAction(string name, VampiroControl behaviour, object value)
    {
        
    }

   

}
